class Solution:
    def repeatedSubstringPattern(self, s: str) -> bool:
        n = len(s)
        if s == s[0] * len(s) and len(s) != 1:
            return True
        i = 2
        while len(s) >= i*i:
            if n % i == 0:
                # print(i)
                if s == s[:(len(s) // i)] * i or s == s[:i] *(len(s) // i):
                    return True
            i += 1
        return False

if __name__ == '__main__':
    s = Solution()
    print(s.repeatedSubstringPattern('abab'))
    print(s.repeatedSubstringPattern('aba'))
    print(s.repeatedSubstringPattern('abcabcabcabc'))
    print(s.repeatedSubstringPattern('zzz'))
    print(s.repeatedSubstringPattern('aa'))
    print(s.repeatedSubstringPattern('abcabc'))
    print(s.repeatedSubstringPattern("abcdabcdabcdabcdabcd"))
